#ifndef TEXTFILE_H_
#define TEXTFILE_H_

// By: Jesse Guarascia de Urena
// Text File Class
// Facilitates File I/O

#include <fstream>
#include "DebugSys.h"

class TextFile
{
private:
	std::fstream file; // File instance

public:
	TextFile(void);
	~TextFile(void);

	// Open the given file for the file stream
	void Open(std::string loc);

	// Close the file stream if necessary
	void Close();
	
	// Get text from the file
	std::string Get();
	std::string GetLine();
	std::string GetAll();
	std::string GetChunk(int start, int end, char d = '*');

	char GetChar();

	TextFile& operator>> (std::string s);

	// Write to the file
	void Write(std::string text);

	TextFile& operator<< (std::string s);

	// Get W-o-N the file is open
	inline bool isOpen() { return file.is_open(); }
};

#endif // TEXTFILE_H

